/*!
 * Copyright (c) 2008-2018 Haulmont.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

$c-timefield-hour-width: 32px;
$c-timefield-minute-width: 58px;
$c-timefield-second-width: 84px;
$c-timefield-ampm-width: 62px !default;

@mixin halo-cuba-timefield($primary-stylename: c-timefield) {
  .#{$primary-stylename}-layout {
    white-space: nowrap;
    outline: 0;
  }

  .#{$primary-stylename} {
    @include box-defaults;
    @include valo-textfield-style;
    height: $v-unit-size;
  }

  .#{$primary-stylename}-wrapper.v-has-width {
    .#{$primary-stylename}-layout {
      display: inline-flex;
    }

    .#{$primary-stylename} {
      width: 100%;
    }
  }

  .#{$primary-stylename}.v-readonly {
    @include valo-textfield-readonly-style;

    &:focus {
      border-color: $v-focus-color;
    }
  }

  .#{$primary-stylename}-error {
    @include valo-textfield-error-style;
  }

  .#{$primary-stylename}-hour {
    width: $c-timefield-hour-width;
  }

  .#{$primary-stylename}-minute {
    width: $c-timefield-minute-width;
  }

  .#{$primary-stylename}-second {
    width: $c-timefield-second-width;
  }

  .c-focus-move::selection {
    background: transparent;
  }

  .c-focus-move::-moz-selection {
    background: transparent;
  }

  .#{$primary-stylename}-ampm {
    width: $c-timefield-ampm-width;
    min-width: $c-timefield-ampm-width;
    margin-left: round($v-layout-spacing-horizontal/2);
  }
}